//
//  LikeTask.m
//  ZooNgonDoiOS
//
//  Created by Anh Jun Linh Tinh on 7/5/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "LikeTask.h"
#import "RestKit/JSONKit.h"

@implementation LikeTask
-(id)initWithSpotId:(NSString *)spot_id{
    self = [super init];
    if(self){
        _spot_id = spot_id;
    }
    return self;
}

-(void)doExecute{
    NSString* strSpotId = [NSString stringWithFormat:@"%i", _spot_id];
    NSDictionary *params = [NSDictionary dictionaryWithObject:strSpotId forKey:@"spot_id"];
    [[RKObjectManager sharedManager].client get:@"/spot/like" queryParameters:params delegate:self];
}

-(void)request:(RKRequest *)request didFailLoadWithError:(NSError *)error{
    
}

-(void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response{
    NSString *jsonString = [response bodyAsString];
    NSDictionary *json = [jsonString objectFromJSONString];
    NSNumber *status = [json objectForKey:@"status"];
    if(status){
        //Call backk chua ro du lieu callb ack
    }
    
}
@end
